﻿<UserControl x:Class="TFS.Kanban.Modules.ProjectExplorer.Views.ProjectExplorerView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             xmlns:Behaviors="clr-namespace:TFS.Kanban.Commons.Behaviors;assembly=TFS.Kanban.Commons" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
	
	<DockPanel>
		<Grid DockPanel.Dock="Left" Margin="2">
			<Grid.RowDefinitions>
				<RowDefinition Height="Auto" />
				<RowDefinition Height="Auto" />
				<RowDefinition Height="*" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
			<Grid.ColumnDefinitions>
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition Width="Auto" />
				<ColumnDefinition Width="Auto" />
			</Grid.ColumnDefinitions>
            
            <Button Grid.Row="0" 
                    Grid.ColumnSpan="3"
                    HorizontalAlignment="Stretch"
                    Content="Get Projects" 
                    Command="{Binding GetProjectsCommand}" />

			<Label Grid.Row="1" Grid.Column="0" Content="Project: " HorizontalContentAlignment="Right" />
			<ComboBox Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left" Width="200"
                      ItemsSource="{Binding Projects}" SelectedItem="{Binding SelectedProject}">
				<ComboBox.ItemTemplate>
					<DataTemplate>
						<Label Content="{Binding Name, Mode=OneWay}" />
					</DataTemplate>
				</ComboBox.ItemTemplate>
			</ComboBox>
			<Button Grid.Row="1" Grid.Column="2" Content="Select" Width="60" Command="{Binding ProjectSelectedCommand}" />

			<TreeView Grid.Row="2" 
                      Grid.ColumnSpan="3" 
                      ItemsSource="{Binding Iterations}"
                      Behaviors:TreeView.CanTrackSelectedItem="true"
                      Behaviors:TreeView.SelectedItem="{Binding SelectedPath}">
                
				<TreeView.ItemContainerStyle>
					<Style TargetType="{x:Type TreeViewItem}">
						<Setter Property="IsExpanded" Value="{Binding IsExpanded, Mode=TwoWay}" />
						<Setter Property="IsSelected" Value="{Binding IsSelected, Mode=TwoWay}" />
						<Setter Property="FontWeight" Value="Normal" />
						<Style.Triggers>
							<Trigger Property="IsSelected" Value="True">
								<Setter Property="FontWeight" Value="Bold" />
							</Trigger>
						</Style.Triggers>
					</Style>
				</TreeView.ItemContainerStyle>

				<TreeView.ItemTemplate>
					<HierarchicalDataTemplate ItemsSource="{Binding Areas}">
						<TextBlock Text="{Binding Name}" />
					</HierarchicalDataTemplate>
				</TreeView.ItemTemplate>
                
			</TreeView>

            <Button Grid.Row="3" 
                    Grid.ColumnSpan="3"
                    Content="Select"
                    Command="{Binding PathSelectedCommand}" />
            
		</Grid>

		</DockPanel>
</UserControl>
